﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EntityModel;
using BusinessLayer;

namespace PL___Windows_Inteface
{
    public partial class AcessWindow : Form
    {
        public Employee logged_emp;
        public AcessWindow()
        {
            InitializeComponent();
        }

        private void login_bt_Click(object sender, EventArgs e)
        {
          logged_emp = new Employee(username_tb.Text, password_tb.Text, "");
            BL controller = new BL();
           try {
               logged_emp = controller.LoginEmployee(logged_emp);
               error_lb.Text = "Welcome: " + logged_emp.name;
               DialogResult = DialogResult.OK;
               Hide();
                    
              
               
            }
            catch(Exception ex){
                error_lb.Text = ex.Message;
            }
        }
    }
}
